package com.example.wanandroid.service.impl;

import com.example.wanandroid.mapper.AnswerMapper;
import com.example.wanandroid.pojo.Answer;
import com.example.wanandroid.service.AnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @Desc TODO
 * @Author 小强
 * @Date 2020/4/18 14:18
 */
@Service
public class AnswerServiceImpl implements AnswerService {
    @Autowired
    AnswerMapper answerMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return answerMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Answer record) {
        return answerMapper.insertSelective(record);
    }

    @Override
    public Answer selectByPrimaryKey(Long id) {
        return answerMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(Answer record) {
        return answerMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<HashMap<String, Object>> listMyAnswers(Long userid, int start, int pageSize) {
        return answerMapper.listMyAnswers(userid, start, pageSize);
    }

    @Override
    public List<HashMap<String, Object>> listAnswersByQuestionId(Long questionId, int start, int pageSize) {
        return answerMapper.listAnswersByQuestionId(questionId,start,pageSize);
    }
}
